package com.bishe.controller;

import com.bishe.pojo.User;
import com.bishe.pojo.UserBill;
import com.bishe.pojo.response.Result;
import com.bishe.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.NonNull;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("user")
@Api(tags = "用户控制器")
public class UserController {

    @Resource
    private UserService userService;

    @ApiOperation("修改个人信息")
    @PostMapping("/update")
    public Result<?> update(@RequestBody User user) {
        return Result.ok(userService.updateById(user));
    }

    @ApiOperation("查看个人信息")
    @GetMapping("/getInfo/{id}")
    public Result<?> getInfo(@PathVariable String id) {
        return Result.ok(userService.getById(id));
    }
}
